local skynet = require "skynet"
local cluster = require "skynet.cluster"
require "skynet.manager"
local json = require "cjson"
json.encode_sparse_array(true,1,1)

local filelog = require "filelog"
local configdao = require "configdao"
local nodename = "zrsxnode"

skynet.start(function()
	skynet.error(nodename .. " start")
	skynet.newservice("nodelog")
	local confsharesvr = skynet.newservice("confshare")
	skynet.call(confsharesvr, "lua", "start")

	if not skynet.getenv "daemon" then
		local console = skynet.newservice("console")
	end

	skynet.name(".router", skynet.uniqueservice("router"))	
	skynet.name(".gmmqredis", skynet.uniqueservice("redisdb"))	
	skynet.call(".gmmqredis", "lua", "init", configdao.get_cfgsvrs_key("gmmqredis"))

	skynet.name(".nodeuuid", skynet.uniqueservice("nodeuuid") )

	skynet.name(".gamedatalog", skynet.newservice("datalog"))
	skynet.call(".gamedatalog", "lua", "init", "gamedata")	
	
	skynet.newservice("webserver")	
	
	cluster.open(nodename)

end)
